package com.goods.controller.business;

import com.goods.business.service.HealthService;
import com.goods.common.model.business.Health;
import com.goods.common.response.ResponseBean;
import com.goods.common.vo.business.HealthVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 健康打卡
 *
 **/
@Api(tags = "健康报备-健康打卡相关接口")
@RequestMapping("/business/health")
@RestController
public class HealthController {
    @Autowired
    private HealthService HealthService;

    //今日是否打卡
    @GetMapping("/isReport")
    public ResponseBean isReport() {
        HealthVO data = HealthService.isReport();
        return ResponseBean.success(data);
    }

    //打卡
    @PostMapping("/report")
    public ResponseBean doReport(@RequestBody HealthVO healthVO) {
        HealthService.doReport(healthVO);
        return ResponseBean.success();
    }

    //查看打卡历史记录
    @GetMapping("/history")
    public ResponseBean getHistory(@RequestParam Map pageMap) {
        Map resultMap = HealthService.getHistory(pageMap);
        return ResponseBean.success(resultMap);
    }
}
